using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.HomeServer.SDK.Interop.v1;

public static class IUserInfoExtensionMethods
{
    public static string GetFullName(this IUserInfo user)
    {
        if (user == null)
            throw new NullReferenceException("user is null");

        if (user.IsGuestUser())
            return user.LogOnName;

        return string.Format(
            WhsFacebook.Whs.Properties.Resources.txtUserFullNameFormat,
            user.FirstName,
            user.LastName
            );
    }

    public static bool IsGuestUser(this IUserInfo user)
    {
        if (user == null)
            throw new NullReferenceException("user is null");

        return string.IsNullOrEmpty(user.FirstName);
    }
}
